Setting is the time a story takes place and also the location where the story takes place. The setting can contribute to the mood of the story, so the time and location of the story can say something about what happens in the story.
The setting can change during a story. For instance, a book could initially be about a young prince who grows up in a castle and later you read about him as an adult king fighting at the battlefield.
In almost all books the setting, along with character and plot are a fundamental parts of the story.